﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Text;

namespace XLDL.Includes
{
    public partial class XemNhieu : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            // Page.MaintainScrollPositionOnPostBack = true;
            
                xuat_luoi();
           

        }
        protected void xuat_luoi()
        {
            DataTable tb = new DataTable();
            tb = XLDL.XLDaTa("select * from V_Counter ORDER BY solanxem_sp DESC");
            StringBuilder str=new StringBuilder();
            if (tb.Rows.Count != 0)
            {
                string img = "";
                string path = System.Configuration.ConfigurationManager.AppSettings["Images_Path"];
                for (int i = 0; i <= tb.Rows.Count - 1; i++)
                {
                   
                    string gia = tb.Rows[i]["giasp"].ToString();//../index.aspx?act=ChiTiet&ID=<%# Eval("ID_SP")%>&NID=<%# Eval("ID_nhom_SP")%>">
                    str.Append("<div class='glidecontent'>");
                    str.Append("<table cellpadding='0' cellspacing='0' border='0'>");
                    str.Append("<tr><td class='pic_padd'>");
                    str.Append("<table cellpadding='0' cellspacing='0' border='0' align='center' class='wrapper_pic_table'>");
                    str.Append("<tr><td class='wrapper_pic_td'><a href='../index.aspx?act=chitiet&id=" + tb.Rows[i]["id_sp"].ToString() + "&nid=" + tb.Rows[i]["id_nhom_sp"].ToString() + "&Gt=" + tb.Rows[i]["id_gt"].ToString() + "'><img src='" + path + tb.Rows[i]["hinh_anh"].ToString() + "' border='0' alt='' width='190' height='210'></a></td></tr>");
                    str.Append("</table>");
                    str.Append("</td></tr>");
                    if (tb.Rows[i]["moi_cu"].ToString() == "True")
                    {
                        img = "<img src='images/new_icon.gif' border='0' width='28' />";
                        str.Append("<tr><td style='padding-left:8px;padding-top:1px;color:#da0750' align='left'>" + tb.Rows[i]["ten_sp"].ToString() + " (MS" + tb.Rows[i]["id_sp"].ToString() + ") " + img + "</td></tr>");
                    
                    }
                    else
                    {
                        str.Append("<tr><td style='padding-left:8px;color:#da0750' align='left'>" + tb.Rows[i]["ten_sp"].ToString() + " (MS" + tb.Rows[i]["id_sp"].ToString() + ")</td></tr>");
                     }
                    str.Append("<tr><td style='padding-left:8px;padding-top:0px;color:#da0750' align='left'>Giá lẻ: " + gia + " VNĐ</td></tr>");
                    str.Append("<tr><td style='padding-left:8px;padding-top:0px;color:#da0750' align='left'>Giá sỉ: Call</td></tr>");
                    str.Append("<tr><td style='padding-right:2px;padding-top:0px;' align='right'>");
                    str.Append("<a href='../index.aspx?act=chitiet&id=" + tb.Rows[i]["id_sp"].ToString() + "&nid=" + tb.Rows[i]["id_nhom_sp"].ToString() + "&Gt=" + tb.Rows[i]["id_gt"].ToString() + "'><img src='Images/Chitiet.gif' border='0' alt='' /></a></td></tr>");
                    str.Append("</table>");
                    str.Append("</div>");
                    // img = "";
                }
              
            }
            lbl_xemnhieu.Text = str.ToString();

        }     


    }
}